package com.kayang.wechat.service;


import com.kayang.common.HttpResilience4jCommand;
import com.kayang.common.aop.IService;
import com.kayang.wechat.pojo.WechatContext;
import com.kayang.wechat.pojo.msg.BaseMsg;
import org.springframework.stereotype.Service;

import java.util.Map;

@Service
public class MessageService implements IService {
    public String getBeforeSp() {
        // 参数{String json}  json请求信息，请求后包含响应。
        return "WSP_MsgEdit";
    }

    @Override
    public String getAfterSp() {
        // 参数{String json}  json请求信息，请求后包含响应。
        return "WSP_MsgEdit";
    }


    public Map send(BaseMsg msg, WechatContext context) {
        HttpResilience4jCommand httpResilience4jCommand = new HttpResilience4jCommand(context.getUrl(), context.getMethod(), msg.toMap(msg));
        Map ret = httpResilience4jCommand.execute();
        context.setRespbody(ret);

        return ret;
    }
}
